package com.zhifei.web.controller.ding;

import com.alibaba.fastjson.JSONObject;
import com.zhifei.common.utils.Result;
import com.zhifei.system.service.DingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/ding")
@Api(tags="钉钉接口管理")
public class DingController {

    @Autowired
    private DingService dingService;

    @PostMapping("/callBack")
    @ApiOperation("钉钉事件订阅")
    public Map<String, String> callBack(@RequestParam(value = "msg_signature", required = false) String msg_signature,
                                        @RequestParam(value = "timestamp", required = false) String timeStamp,
                                        @RequestParam(value = "nonce", required = false) String nonce,
                                        @RequestBody(required = false) JSONObject json) {
        return dingService.callBack(msg_signature, timeStamp, nonce, json);
    }

    @GetMapping("/test")
    @ApiOperation("测试")
    public Result test(){
        return dingService.test();
    }

}


